package com.second.mapper;

import com.second.model.pojo.FReply;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 本类用来演示:
 *
 * @author: MuTing
 * @date: 2022-04-17 17:44
 */
@Repository
public interface FReplyMapper extends JpaRepository <FReply,Integer>{

    @Query(value = "from FReply where commentId=:commentId and replyId=:replyId" )
    List<FReply> findByCommentIdAndReplyId(@Param("commentId") Integer commentId,@Param("replyId") Integer replyId);

    //自定义DML操作
    @Modifying
    @Query(value = "delete from FReply where id=?1")
    int delByReplyId(Integer id);

}
